package com.kun.controller;

import com.kun.annotation.MethodPermissionCheck;
import com.kun.common.enumType.LevelEnum;
import com.kun.common.domain.AjaxResult;
import com.kun.domain.TUserMoments;
import com.kun.service.service.ITUserMomentsService;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/t-user-moments")
public class TUserMomentsController extends BaseController{

    private final ITUserMomentsService itUserMomentsService;

    public TUserMomentsController(ITUserMomentsService itUserMomentsService) {
        this.itUserMomentsService = itUserMomentsService;
    }

    /**
     * 发布动态
     */
    @MethodPermissionCheck(value = "user:moment:submission", role = LevelEnum.LEVEL_ONE)
    @PostMapping
    public ResponseEntity<AjaxResult> addUserMoments(@Validated @RequestBody TUserMoments tUserMoments) {
        return success(itUserMomentsService.addUserMoments(tUserMoments));
    }

    /**
     * 查询当前用户订阅的内容
     */
    @GetMapping("/subscribed")
    public ResponseEntity<AjaxResult> getSubscribed() {
        return success(itUserMomentsService.getSubscribed());
    }



}
